﻿using GDI_应用案例.Pages.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GDI_应用案例.Pages
{
    [FormPage(5, "文字点选")]
    public partial class PageTextSelectionCode : PageBase
    {
        public PageTextSelectionCode()
        {
            InitializeComponent();
            // 测试图片在项目目录下
            string path=AppDomain.CurrentDomain.BaseDirectory;
            path = Path.Combine(path, "验证码图形");
            if (!Directory.Exists(path))
                throw new AggregateException("文件路径不存在");

            string[] files = { Path.Combine(path,"88e2ace3d42574010217e7c54ced0a15.png"), Path.Combine(path,"9aa04d574fca3f2a442fa07c16ad3b29.png"), Path.Combine(path,"88e2ace3d42574010217e7c54ced0a15(1).png") };
            string[] words = {
    "狐假虎威", "画龙点睛", "井底之蛙", "守株待兔", "掩耳盗铃",
    "刻舟求剑", "滥竽充数", "亡羊补牢", "对牛弹琴", "画蛇添足",
    "自相矛盾", "班门弄斧", "杞人忧天", "杯弓蛇影", "叶公好龙",
    "望梅止渴", "拔苗助长", "买椟还珠", "南辕北辙", "东施效颦",
    "邯郸学步", "囫囵吞枣", "螳臂当车", "黔驴技穷", "鹬蚌相争",
    "狼狈为奸", "鱼目混珠", "狗尾续貂", "狐朋狗友", "鸡犬不宁",
    "狼吞虎咽", "鹤立鸡群", "鸦雀无声", "龙飞凤舞", "虎头蛇尾",
    "牛鬼蛇神", "鸡飞狗跳", "马到成功", "羊肠小道", "猴年马月",
    "猪狗不如", "鼠目寸光", "牛鼎烹鸡", "虎背熊腰", "兔死狐悲",
    "龙马精神", "蛇蝎心肠", "马革裹尸", "羊入虎口", "猴头猴脑",
    "鸡鸣狗盗", "狗急跳墙", "猪突豨勇", "鼠窃狗偷", "牛刀小试",
    "虎视眈眈", "兔起鹘落", "龙潭虎穴", "蛇鼠一窝", "马不停蹄",
    "羊质虎皮", "猴戏人间", "鸡犬升天", "狗仗人势", "猪朋狗友",
    "鼠肝虫臂", "牛高马大", "虎落平阳", "兔死狗烹", "龙争虎斗",
    "蛇影杯弓", "马首是瞻", "羊狠狼贪", "猴年马月", "鸡毛蒜皮",
    "狗血淋头", "猪卑狗险", "鼠肚鸡肠", "牛衣对泣", "虎口拔牙",
    "兔走乌飞", "龙肝凤髓", "蛇口蜂针", "马耳东风", "羊落虎口",
    "猴年马月", "鸡飞蛋打", "狗吠非主", "猪突豨勇", "鼠目獐头",
    "牛骥同皂", "虎踞龙盘", "兔角龟毛", "龙蛇混杂", "蛇蝎为心",
    "马放南山", "羊触藩篱", "猴年马月", "鸡犬不宁", "狗尾续貂",
    "猪狗不如", "鼠窃狗盗", "牛溲马勃", "虎尾春冰", "兔起凫举",
    "龙腾虎跃", "蛇行鼠步", "马齿徒增", "羊肠九曲", "猴年马月"
};
            textSelectionCodeControl1.SelectionCode.SetWords(words);
            textSelectionCodeControl1.SelectionCode.SetImages(files);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            textSelectionCodeControl1.Create();
            button1.Enabled=true;
        }

        private void pictureBox1_DoubleClick(object sender, EventArgs e)
        {
           
        }

        private void PageTextSelectionCode_FormClosing(object sender, FormClosingEventArgs e)
        {
            textSelectionCodeControl1.Dispose();
            this.Dispose();
        }
    }
}
